//
//  reconmendCell.m
//  SoundPill
//
//  Created by 宋旭东 on 16/4/1.
//  Copyright © 2016年 宋旭东. All rights reserved.
//

#import "reconmendCell.h"
#import "UIViewExt.h"

@interface reconmendCell ()

@end

@implementation reconmendCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
//        self.layer.cornerRadius = 20;
        [self createSubviews];
    }
    return self;
}
- (void)createSubviews
{
    self.cover = [[UIImageView alloc] initWithFrame:CGRectZero];
    _cover.frame = CGRectMake(23, 23, self.width - 46, self.width-46);
    [_cover setContentScaleFactor:[[UIScreen mainScreen] scale]];
    _cover.contentMode =  UIViewContentModeScaleAspectFill;
    _cover.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    _cover.clipsToBounds  = YES;
    [self addSubview:_cover];
    
    self.coverBackground = [[UIView alloc] initWithFrame:_cover.frame];
    _coverBackground.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.302];
    [self addSubview:_coverBackground];
    
//    self.playBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [self addSubview:_playBtn];

    UIImageView *waveImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"recommendWave"]];
    waveImageView.frame = CGRectMake(_cover.center.x - 2, _cover.bottom - 30, _cover.width / 2, 30);
    [self addSubview:waveImageView];
    
    self.tagImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"quotes"]];
    [self addSubview:_tagImage];
    
    self.workDate = [[UILabel alloc] initWithFrame:CGRectZero];
    _workDate.font = [UIFont boldSystemFontOfSize:20];
    _workDate.textColor = [UIColor whiteColor];
    _workDate.textAlignment = NSTextAlignmentCenter;
    _workDate.lineBreakMode = NSLineBreakByWordWrapping;
    _workDate.numberOfLines = 0;
    _workDate.backgroundColor = [UIColor colorWithRed:0.875 green:0.302 blue:0.243 alpha:1.00];
    [self addSubview:_workDate];
    
    self.workTime = [[UILabel alloc] initWithFrame:CGRectZero];
    _workTime.frame = CGRectMake(_cover.left, _cover.bottom, _cover.width, 20);
    _workTime.font = [UIFont systemFontOfSize:12];
    _workTime.textAlignment = NSTextAlignmentRight;
    [self addSubview:_workTime];
    
    self.workName = [[UILabel alloc] initWithFrame:CGRectZero];
    _workName.frame = CGRectMake(_cover.left, _workTime.bottom, _cover.width, 30);
    _workName.font = [UIFont boldSystemFontOfSize:20];
    _workName.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_workName];
    
    self.reconmendReson = [[UILabel alloc] initWithFrame:CGRectZero];
    _reconmendReson.textColor = [UIColor grayColor];
    _reconmendReson.font = [UIFont systemFontOfSize:14];
    _reconmendReson.numberOfLines = 0;
    _reconmendReson.lineBreakMode = NSLineBreakByWordWrapping;
    [self addSubview:_reconmendReson];
    
    self.avatar = [[UIImageView alloc] initWithFrame:CGRectZero];
    _avatar.backgroundColor = [UIColor redColor];
    
    [self addSubview:_avatar];
    self.userName = [[UILabel alloc] initWithFrame:CGRectZero];
    
    _userName.font = [UIFont boldSystemFontOfSize:13];
    [self addSubview:_userName];
    
    self.shareImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"play_sharemenu@3x"]];
    [self addSubview:_shareImage];
    
    self.shareTitle = [[UILabel alloc] initWithFrame:CGRectZero];
    _shareTitle.text = @"分享";
    _shareTitle.font = [UIFont boldSystemFontOfSize:14];
    [self addSubview:_shareTitle];
    
    self.shareBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:_shareBtn];
    
    self.signButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _signButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    [self addSubview:_signButton];
    
    
//    [_playBtn addTarget:self action:@selector(playBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    
}
- (void)playBtnClick:(UIButton *)sender
{
    [_playBtn setImage:nil forState:UIControlStateNormal];
    _playBlock(_model.UserID, _model.CinemeID);
}
@end
